﻿<%@ Page Title="" Language="C#" MasterPageFile="~/BackEnd.master" AutoEventWireup="true" CodeFile="~/Code/DMS_cnjob.aspx.cs" Inherits="DMS_cnjob" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cph_Main" Runat="Server">
    <table style="width: 100%;">
        <tr>
            <td style="width: 140px; height: 30px" valign="top">
                Incident ID:
            </td>
            <td style="height: 30px">
                <asp:TextBox ID="incnum_TB" runat="server" ReadOnly="True" Width="170px"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td style="width: 140px; height: 30px;" valign="top">
                Date Created:</td>
            <td style="height: 30px">
                <asp:TextBox ID="date_TB" runat="server" ReadOnly="True" Width="170px"></asp:TextBox>
&nbsp;</td>
        </tr>
        <tr>
            <td style="width: 140px" valign="top">
                Assigned Team:</td>
            <td>
                <asp:DropDownList ID="dd_Teams" runat="server" DataSourceID="teams_DS" 
                    DataTextField="TeamName" DataValueField="TeamName" Width="170px">
                </asp:DropDownList>
                <asp:AccessDataSource ID="teams_DS" runat="server" 
                    DataFile="~/App_Data/Database.accdb" 
                    SelectCommand="SELECT Teams.TeamName, [Organisation.Organisation_Name] AS Organisation FROM (Teams INNER JOIN Organisation ON Teams.[Organisation Name] = Organisation.Org_ID) WHERE (Teams.Resting = ?) AND (Teams.[Currently working] = ?) AND (Teams.TeamName &lt;&gt; 'public')">
                    <SelectParameters>
                        <asp:Parameter DefaultValue="False" Name="Resting" Type="Boolean" />
                        <asp:Parameter DefaultValue="False" Name="Currently_working" Type="Boolean" />
                    </SelectParameters>
                </asp:AccessDataSource>
            </td>
        </tr>
        <tr>
            <td style="height: 23px; width: 140px" valign="top">
                Description::</td>
            <td style="height: 23px">
                <asp:TextBox ID="desc_TB" runat="server" 
                    Height="100px" Rows="2" Width="100%" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
    </table>

    <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
        DataFile="~/App_Data/Database.accdb" 
        DeleteCommand="DELETE FROM [Jobs] WHERE [Job_ID] = ?" 
        InsertCommand="INSERT INTO [Jobs] ([Incident_ID], [Job_ID], [Description], [Job Completed?], [Date Created], [Date Resolved], [Assigned Team]) VALUES (?, ?, ?, ?, ?, ?, ?)" 
        SelectCommand="SELECT DISTINCT Jobs.[Assigned Team] FROM (Jobs INNER JOIN Teams ON Jobs.[Assigned Team] = Teams.Team_ID) WHERE (Teams.TeamName = ?)" 
        UpdateCommand="UPDATE [Jobs] SET [Incident_ID] = ?, [Description] = ?, [Job Completed?] = ?, [Date Created] = ?, [Date Resolved] = ?, [Assigned Team] = ? WHERE [Job_ID] = ?">
        <DeleteParameters>
            <asp:Parameter Name="Job_ID" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Incident_ID" Type="Int32" />
            <asp:Parameter Name="Job_ID" Type="Int32" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="column1" Type="Boolean" />
            <asp:Parameter Name="Date_Created" Type="DateTime" />
            <asp:Parameter Name="Date_Resolved" Type="DateTime" />
            <asp:Parameter Name="Assigned_Team" Type="Int32" />
        </InsertParameters>
        <SelectParameters>
            <asp:Parameter Name="?" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Incident_ID" Type="Int32" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:Parameter Name="column1" Type="Boolean" />
            <asp:Parameter Name="Date_Created" Type="DateTime" />
            <asp:Parameter Name="Date_Resolved" Type="DateTime" />
            <asp:Parameter Name="Assigned_Team" Type="Int32" />
            <asp:Parameter Name="Job_ID" Type="Int32" />
        </UpdateParameters>
    </asp:AccessDataSource>

    <br />
    <asp:Button ID="submit_btn" runat="server" Text="Create New Job" 
        onclick="submit_btn_Click" Width="150px" />
    <asp:Button ID="cncl_btn" runat="server" onclick="cncl_btn_Click" Text="Cancel" 
        Width="150px" />
    </asp:Content>

